package com.ymatou.iapi.payment.testcase;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.ymatou.iapi.payment.parameter.CheckCmbPaymentBean;
import com.ymatou.iapi.payment.service.CheckCmbPaymentCall;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.TestCase;
import com.ymt.utils.annotation.TestSuite;
import com.ymt.utils.tag.P1;
import com.ymt.utils.tag.P3;

/**
 * 系统自动审核退款 FreeMaker Template自动生成代码
 * 20190722 废除 @王旭东
 */
@TestSuite
public class Ts_CheckCmbPayment {
	private static CheckCmbPaymentBean CheckCmbPaymentBean;
	private static CheckCmbPaymentCall CheckCmbPaymentCall;

	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("招行对账");
	}

	@Before
	public void caseUp() {
		CheckCmbPaymentBean = new CheckCmbPaymentBean();
		CheckCmbPaymentCall = new CheckCmbPaymentCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(CheckCmbPaymentCall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}

	@Test
	@Category({ P1.class })
	@TestCase
	@Ignore
	public void Tc_CheckCmbPayment_001() {
		Logger.start(true, "对账成功");
		try {
			CheckCmbPaymentBean.setDate("2016-12-17");
			CheckCmbPaymentBean.setNo("1");
			CheckCmbPaymentCall.setData(CheckCmbPaymentBean);
			CheckCmbPaymentCall.callService();
			Logger.verifyEquals("ok", CheckCmbPaymentCall.getReturnData(), "验证返回");
//			TODO check data
//			select top 100 * from PP_PaymentCheck where uploadfile like '%2016-12-17%'
//			select top 100 * from PP_PaymentCheckDetail where PaymentCheckId = 41
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P3.class })
	@TestCase
	@Ignore
	public void Tc_CheckCmbPayment_002() {
		Logger.start(true, "不输入date,失败");
		try {
//			CheckCmbPaymentBean.setDate("2016-12-16");
			CheckCmbPaymentBean.setNo("1");
			CheckCmbPaymentCall.setData(CheckCmbPaymentBean);
			CheckCmbPaymentCall.callService();
			Logger.verifyIsContains("调度日期不能为空", CheckCmbPaymentCall.getString("errorMessage"), "验证返回errorMessage");
			Logger.verifyEquals("false", CheckCmbPaymentCall.getString("isSuccess"), "验证返回isSuccess");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P3.class })
	@TestCase
	@Ignore
	public void Tc_CheckCmbPayment_003() {
		Logger.start(true, "不輸入no,失败");
		try {
			CheckCmbPaymentBean.setDate("2016-12-16");
//			CheckCmbPaymentBean.setNo("1");
			CheckCmbPaymentCall.setData(CheckCmbPaymentBean);
			CheckCmbPaymentCall.callService();
			Logger.verifyIsContains("对账序号不能为空", CheckCmbPaymentCall.getString("errorMessage"), "验证返回errorMessage");
			Logger.verifyEquals("false", CheckCmbPaymentCall.getString("isSuccess"), "验证返回isSuccess");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

}